<?php
use_helper('I18N');
/** @var Array of menu items */ $items = $sf_data->getRaw('items');
/** @var Array of categories, each containing an array of menu items and settings */ $categories = $sf_data->getRaw('categories');
?>


<?php if (count($items)): ?>
<ul>
        <?php if (sfAdminDash::hasItemsMenu($items)): ?>
    <li class="node"><a href="#">Menu</a>
        <ul>
                    <?php include_partial('sfAdminDash/menu_list', array('items' => $items, 'items_in_menu' => true)); ?>
        </ul>
    </li>
        <?php  endif; ?>
        <?php include_partial('sfAdminDash/menu_list', array('items' => $items, 'items_in_menu' => false)); ?>
</ul>
<?php endif; ?>
<?php if (count($categories)): ?>
<ul>
        <?php foreach ($categories as $name => $category): ?>
            <?php   if (sfAdminDash::hasPermission($category, $sf_user)): ?>
                <?php     if (sfAdminDash::hasItemsMenu($category['items'])): ?>
    <li class="node"><a href="#"><?php echo isset($category['name']) ? $category['name'] : $name ?></a>
        <ul>
                            <?php include_partial('sfAdminDash/menu_list', array('items' => $category['items'], 'items_in_menu' => true)) ?>
        </ul>
    </li>
                <?php     endif; ?>
            <?php   endif; ?>
        <?php endforeach; ?>
        <?php foreach ($categories as $name => $category): ?>
            <?php include_partial('sfAdminDash/menu_list', array('items' => $category['items'], 'items_in_menu' => false)) ?>
        <?php endforeach; ?>





    <!--  AJOUT -->
    <!-- MENU RAPIDE -->
        <?php if($sf_user->hasCredential('frontend')) { ?>
    <li class="node" style="background: #555555; -moz-border-radius: 20px;-webkit-border-radius: 20px; margin-left: 10px;"><a href="#">Ajout Rapide</a>
        <ul>
            <li class="item">
                <a href="<?php echo url_for('contact/new') ?>" title="Contact">
                    <img alt="Contact" src="/sfAdminDashPlugin/images/icons/small/support.png" height="16" width="16">
                    <span>Contact</span>
                </a>
            </li>
            <li class="item">
                <a href="<?php echo url_for('groupe/new') ?>" title="Groupe">

                    <img alt="Groupe" src="/sfAdminDashPlugin/images/icons/small/users.png" height="16" width="16">
                    <span>Groupe</span>
                </a>
            </li>
            <li class="item">
                <a href="<?php echo url_for('evenement/new') ?>" title="Evenement">
                    <img alt="Evenement" src="/sfAdminDashPlugin/images/icons/small/module.png" height="16" width="16">
                    <span>Evènement</span>
                </a>
            <li class="item">
            <li class="item">
                <a href="<?php echo url_for('location/new') ?>" title="Location">
                    <img alt="Location" src="/sfAdminDashPlugin/images/icons/small/frontpage.png" height="16" width="16">
                    <span>Location</span>
                </a>
            <li class="item">
                <a href="<?php echo url_for('reservation/new') ?>" title="Réservation">
                    <img alt="Réservation" src="/sfAdminDashPlugin/images/icons/small/addedit.png" height="16" width="16">
                    <span>Réservation</span>

                </a>
            </li>
            <li class="item">
                <a href="<?php echo url_for('ins_abonnement/new') ?>" title="Inscription abonnement">
                    <img alt="Inscription abonnement" src="/sfAdminDashPlugin/images/icons/small/sections.png" height="16" width="16">
                    <span>Inscription ABONNEMENT</span>
                </a>
            </li>
            <li class="item">

                <a href="<?php echo url_for('ins_atelier/new') ?>" title="Inscription atelier">
                    <img alt="Inscription atelier" src="/sfAdminDashPlugin/images/icons/small/sections.png" height="16" width="16">
                    <span>Inscription ATELIER</span>
                </a>
            </li>
            <li class="item">
                <a href="<?php echo url_for('ins_stage/new') ?>" title="Inscription stage">
                    <img alt="Inscription stage" src="/sfAdminDashPlugin/images/icons/small/sections.png" height="16" width="16">
                    <span>Inscription STAGE</span>
                </a>

            </li>

        </ul>
    </li>
    <?php if(count($sf_user->getAttribute('historique'))) { ?>
    <li class="node" style="background: #555555; -moz-border-radius: 20px; -webkit-border-radius: 20px;"><a href="#">Historique contacts</a>
        <ul>
        <?php foreach($sf_user->getAttribute('historique') as $precedent) { ?>
            <?php $objet = Doctrine_Core::getTable('Contact')->find($precedent) ?>
            <li class="item">
                <img alt="Contact" src="/sfAdminDashPlugin/images/icons/small/support.png" height="16" width="16">
                <a href="<?php echo url_for('contact/show?id='. $objet->getId()) ?>" title="<?php echo $objet ?>">
                    <span><?php echo $objet ?></span>
                </a>
            </li>
        <?php } ?>
        </ul>
    </li>
    <?php } ?>
            <?php } ?>
    <!-- FIN AJOUT -->





</ul>
<?php elseif (!count($items)): ?>
    <?php echo __('sfAdminDashPlugin is not configured.  Please see the %documentation_link%.', array('%documentation_link%'=>link_to(__('documentation', null, 'sf_admin_dash'), 'http://www.symfony-project.org/plugins/sfAdminDashPlugin?tab=plugin_readme', array('title' => __('documentation', null, 'sf_admin_dash')))), 'sf_admin_dash'); ?>
<?php endif; ?>